﻿<?xml version="1.0" encoding="utf-8" ?>
<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:my="clr-namespace:SilverlightREPL"
    xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows">

    <Style TargetType="my:CustomScrollViewer">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="my:CustomScrollViewer">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <my:CustomScrollContentPresenter
                            x:Name="Presenter"
                            Content="{TemplateBinding Content}"
                            ContentTemplate="{TemplateBinding ContentTemplate}"
                            VerticalOffset="{Binding Value, ElementName=VerticalScrollBar}" />
                        <ScrollBar
                            x:Name="VerticalScrollBar"
                            IsTabStop="False"
                            Grid.Column="1"
                            Maximum="{Binding ExtentMinusViewportHeight, ElementName=Presenter}"
                            ViewportSize="{Binding ViewportHeight, ElementName=Presenter}"
                            SmallChange="16"
                            LargeChange="{Binding ViewportHeight, ElementName=Presenter}"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style TargetType="my:ExpanderButton">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="my:ExpanderButton">
                    <Grid Margin="{TemplateBinding Padding}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="16" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CommonStates">
                                <vsm:VisualState x:Name="Normal"/>
                                <vsm:VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="Path2" Storyboard.TargetProperty="Opacity" Duration="0" To="1"/>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Pressed" />
                                <vsm:VisualState x:Name="Disabled" />
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="CheckStates">
                                <vsm:VisualState x:Name="Checked">
                                    <Storyboard>
                                        <ColorAnimation Storyboard.TargetName="Path1" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)" Duration="0" To="#262626"/>
                                        <ColorAnimation Storyboard.TargetName="Path1" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Duration="0" To="#595959"/>
                                        <DoubleAnimation Storyboard.TargetName="RotateTransform1" Storyboard.TargetProperty="Angle" Duration="0" To="45"/>
                                        <DoubleAnimation Storyboard.TargetName="RotateTransform2" Storyboard.TargetProperty="Angle" Duration="0" To="45"/>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Unchecked"/>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>
                        <Path x:Name="Path1" Stroke="#A6A6A6" Fill="Transparent" Data="M4.5 2.5 L8.5 6.5 L4.5 10.5Z" Width="12" Height="13" VerticalAlignment="Center">
                            <Path.RenderTransform>
                                <RotateTransform x:Name="RotateTransform1" CenterX="6.5" CenterY="8.5" Angle="0" />
                            </Path.RenderTransform>
                        </Path>
                        <Path x:Name="Path2" Stroke="#27C7F7" Fill="White" Data="M4.5 2.5 L8.5 6.5 L4.5 10.5Z" Width="12" Height="13" VerticalAlignment="Center" Opacity="0">
                            <Path.RenderTransform>
                                <RotateTransform x:Name="RotateTransform2" CenterX="6.5" CenterY="8.5" Angle="0" />
                            </Path.RenderTransform>
                            <Path.Effect>
                                <DropShadowEffect x:Name="BlurEffect"  BlurRadius="2" Color="#27C7F7" ShadowDepth="0" />
                            </Path.Effect>
                        </Path>
                        <ContentPresenter
                            Grid.Column="1"
                            x:Name="contentPresenter"
                            Content="{TemplateBinding Content}"
                            ContentTemplate="{TemplateBinding ContentTemplate}"
                            HorizontalAlignment="Left"
                            VerticalAlignment="Center"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>